package com.imstlife.vending.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.imstlife.vending.activity.SplashActivity;

/**
 * Created by Feng on 2017/8/11.
 */

public class CompleteReceiver extends BroadcastReceiver {

    private String TAG = "CompleteReceiver";


    private String complate ="android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "onReceive: 接受广播："+intent.getAction());
        Toast.makeText(context,intent.getAction()+"<<接受广播",Toast.LENGTH_SHORT).show();
        if(intent.getAction().equals(complate)){
            Intent open = new Intent(context,SplashActivity.class);
            open.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(open);
        }

    }
}
